home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 85 / CD Temático 40 Febrero 2004.iso / DOS / testdisk / src / ntfsprogs.patch < prev    next >
Encoding:
Text File  |  2004-01-04  |  6.0 KB  |  225 lines

  1. diff -ru ntfsprogs-1.8.0/configure.ac ntfsprogs-1.8.0.patch/configure.ac
  2. --- ntfsprogs-1.8.0/configure.ac    Wed Nov 19 11:31:26 2003
  3. +++ ntfsprogs-1.8.0.patch/configure.ac    Sun Jan  4 20:56:14 2004
  4. @@ -168,7 +168,8 @@
  5.  AC_CHECK_HEADERS([fcntl.h libintl.h limits.h locale.h mntent.h stddef.h \
  6.      stdint.h stdlib.h stdio.h stdarg.h string.h strings.h errno.h time.h \
  7.      sys/ioctl.h sys/mount.h unistd.h utime.h wchar.h getopt.h sys/stat.h \
  8. -    sys/types.h asm/byteorder.h linux/major.h linux/fd.h])
  9. +    sys/types.h asm/byteorder.h linux/major.h linux/fd.h \
  10. +    endian.h byteswap.h sys/param.h sys/endian.h features.h])
  11.  
  12.  # Checks for typedefs, structures, and compiler characteristics.
  13.  AC_HEADER_STDBOOL
  14. @@ -192,7 +193,7 @@
  15.  AC_FUNC_UTIME_NULL
  16.  AC_FUNC_VPRINTF
  17.  AC_CHECK_FUNCS([atexit fdatasync hasmntopt memmove memset regcomp setlocale \
  18. -    strcasecmp strchr strdup strerror strtol strtoul utime])
  19. +    strcasecmp strchr strdup strerror strtol strtoul utime mbsinit])
  20.  
  21.  # Makefiles to be created by configure.
  22.  AC_CONFIG_FILES([
  23. diff -ru ntfsprogs-1.8.0/include/endians.h ntfsprogs-1.8.0.patch/include/endians.h
  24. --- ntfsprogs-1.8.0/include/endians.h    Wed Nov 19 11:03:31 2003
  25. +++ ntfsprogs-1.8.0.patch/include/endians.h    Sun Jan  4 21:04:53 2004
  26. @@ -32,9 +32,20 @@
  27.   * turns out that we do need to use the unaligned access macros on
  28.   * architectures requiring aligned memory accesses...
  29.   */
  30. -
  31. -#include <endian.h>
  32. -#include <byteswap.h>
  33. +#ifdef HAVE_ENDIAN_H
  34. +#    include <endian.h>
  35. +#endif
  36. +#ifdef HAVE_SYS_ENDIAN_H
  37. +#    include <sys/endian.h>
  38. +#ifndef __BYTE_ORDER
  39. +#define __BYTE_ORDER _BYTE_ORDER
  40. +#define __LITTLE_ENDIAN _LITTLE_ENDIAN
  41. +#define __BIG_ENDIAN _BIG_ENDIAN
  42. +#endif
  43. +#endif
  44. +#ifdef HAVE_BYTESWAP_H
  45. +#    include <byteswap.h>
  46. +#endif
  47.  
  48.  #if (__BYTE_ORDER == __LITTLE_ENDIAN)
  49.  
  50. diff -ru ntfsprogs-1.8.0/include/volume.h ntfsprogs-1.8.0.patch/include/volume.h
  51. --- ntfsprogs-1.8.0/include/volume.h    Tue Nov  4 13:29:55 2003
  52. +++ ntfsprogs-1.8.0.patch/include/volume.h    Sun Jan  4 20:40:42 2004
  53. @@ -25,13 +25,18 @@
  54.  #include "config.h"
  55.  
  56.  #include <stdio.h>
  57. -#include <sys/mount.h>
  58. +#ifdef HAVE_SYS_PARAM_H
  59. +#    include <sys/param.h>
  60. +#endif
  61. +#ifdef HAVE_SYS_MOUNT_H
  62. +#    include <sys/mount.h>
  63. +#endif
  64.  #ifdef HAVE_MNTENT_H
  65.  #    include <mntent.h>
  66.  #endif
  67.  
  68.  /* Cygwin doesn't seem to have MS_RDONLY, so we define it here. */
  69. -#if defined(__CYGWIN32__) && !defined(MS_RDONLY)
  70. +#if !defined(MS_RDONLY)
  71.  typedef enum {
  72.      MS_RDONLY = 1,
  73.  } MS_MOUNT;
  74. diff -ru ntfsprogs-1.8.0/libntfs/unistr.c ntfsprogs-1.8.0.patch/libntfs/unistr.c
  75. --- ntfsprogs-1.8.0/libntfs/unistr.c    Tue Nov  4 13:29:55 2003
  76. +++ ntfsprogs-1.8.0.patch/libntfs/unistr.c    Sun Jan  4 21:21:07 2004
  77. @@ -321,8 +321,9 @@
  78.      wchar_t wc;
  79.      int i, o, mbs_len;
  80.      int cnt = 0;
  81. +#ifdef HAVE_MBSINIT
  82.      mbstate_t mbstate;
  83. -
  84. +#endif
  85.      if (!ins || !outs) {
  86.          errno = EINVAL;
  87.          return -1;
  88. @@ -339,7 +340,11 @@
  89.          if (!mbs)
  90.              return -1;
  91.      }
  92. +#ifdef HAVE_MBSINIT
  93.      memset(&mbstate, 0, sizeof(mbstate));
  94. +#else
  95. +    wctomb(NULL, 0);
  96. +#endif
  97.      for (i = o = 0; i < ins_len; i++) {
  98.          /* Reallocate memory if necessary or abort. */
  99.          if ((int)(o + MB_CUR_MAX) > mbs_len) {
  100. @@ -361,7 +366,11 @@
  101.          if (!wc)
  102.              break;
  103.          /* Convert the CPU endian wide character to multibyte. */
  104. +#ifdef HAVE_MBSINIT
  105.          cnt = wcrtomb(mbs + o, wc, &mbstate);
  106. +#else
  107. +        cnt = wctomb(mbs + o, wc);
  108. +#endif
  109.          if (cnt == -1)
  110.              goto err_out;
  111.          if (cnt <= 0) {
  112. @@ -372,11 +381,13 @@
  113.          o += cnt;
  114.      }
  115.      /* Make sure we are back in the initial state. */
  116. +#ifdef HAVE_MBSINIT
  117.      if (!mbsinit(&mbstate)) {
  118.          Dputs("Eeek. mbstate not in initial state!");
  119.          errno = EILSEQ;
  120.          goto err_out;
  121.      }
  122. +#endif
  123.      /* Now write the NULL character. */
  124.      mbs[o] = '\0';
  125.      if (*outs != mbs)
  126. @@ -421,8 +432,9 @@
  127.      char *s;
  128.      wchar_t wc;
  129.      int i, o, cnt, ins_len, ucs_len;
  130. +#ifdef HAVE_MBSINIT
  131.      mbstate_t mbstate;
  132. -
  133. +#endif
  134.      if (!ins || !outs) {
  135.          errno = EINVAL;
  136.          return -1;
  137. @@ -435,11 +447,20 @@
  138.      }
  139.      /* Determine the length of the multi-byte string. */
  140.      s = ins;
  141. +#ifdef HAVE_MBSINIT
  142.      memset(&mbstate, 0, sizeof(mbstate));
  143.      ins_len = mbsrtowcs(NULL, (const char **)&s, 0, &mbstate);
  144. +#else
  145. +    ins_len = mbstowcs(NULL, s, 0);
  146. +#endif
  147.      if (ins_len == -1)
  148.          return ins_len;
  149. -    if ((s != ins) || !mbsinit(&mbstate)) {
  150. +#ifdef HAVE_MBSINIT
  151. +    if ((s != ins) || !mbsinit(&mbstate))
  152. +#else
  153. +    if (s != ins)
  154. +#endif
  155. +    {
  156.          errno = EILSEQ;
  157.          return -1;
  158.      }
  159. @@ -451,7 +472,11 @@
  160.          if (!ucs)
  161.              return -1;
  162.      }
  163. +#ifdef HAVE_MBSINIT
  164.      memset(&mbstate, 0, sizeof(mbstate));
  165. +#else
  166. +    mbtowc(NULL, NULL,0);
  167. +#endif
  168.      for (i = o = cnt = 0; o < ins_len; i += cnt, o++) {
  169.          /* Reallocate memory if necessary or abort. */
  170.          if (o >= ucs_len) {
  171. @@ -472,7 +497,11 @@
  172.              ucs_len /= sizeof(uchar_t);
  173.          }
  174.          /* Convert the multibyte character to a wide character. */
  175. +#ifdef HAVE_MBSINIT
  176.          cnt = mbrtowc(&wc, ins + i, ins_len - i, &mbstate);
  177. +#else
  178. +        cnt = mbtowc(&wc, ins + i, ins_len - i);
  179. +#endif
  180.          if (!cnt)
  181.              break;
  182.          if (cnt == -1)
  183. @@ -491,6 +520,7 @@
  184.          /* Convert the CPU wide character to a LE Unicode character. */
  185.          ucs[o] = cpu_to_le16(wc);
  186.      }
  187. +#ifdef HAVE_MBSINIT
  188.      /* Make sure we are back in the initial state. */
  189.      if (!mbsinit(&mbstate)) {
  190.          Dprintf("%s(): Eeek. mbstate not in initial state!\n",
  191. @@ -498,6 +528,7 @@
  192.          errno = EILSEQ;
  193.          goto err_out;
  194.      }
  195. +#endif
  196.      /* Now write the NULL character. */
  197.      ucs[o] = cpu_to_le16(L'\0');
  198.      if (*outs != ucs)
  199. diff -ru ntfsprogs-1.8.0/ntfsprogs/ntfsundelete.c ntfsprogs-1.8.0.patch/ntfsprogs/ntfsundelete.c
  200. --- ntfsprogs-1.8.0/ntfsprogs/ntfsundelete.c    Mon Nov  3 11:50:46 2003
  201. +++ ntfsprogs-1.8.0.patch/ntfsprogs/ntfsundelete.c    Sun Jan  4 21:21:55 2004
  202. @@ -23,7 +23,9 @@
  203.  
  204.  #include "config.h"
  205.  
  206. +#ifdef HAVE_FEATURES_H
  207.  #include <features.h>
  208. +#endif
  209.  #include <stdio.h>
  210.  #include <stdlib.h>
  211.  #include <string.h>
  212. diff -ru ntfsprogs-1.8.0/ntfsprogs/utils.c ntfsprogs-1.8.0.patch/ntfsprogs/utils.c
  213. --- ntfsprogs-1.8.0/ntfsprogs/utils.c    Wed Nov 19 11:31:26 2003
  214. +++ ntfsprogs-1.8.0.patch/ntfsprogs/utils.c    Sun Jan  4 20:54:26 2004
  215. @@ -31,7 +31,9 @@
  216.  #include <unistd.h>
  217.  #include <string.h>
  218.  #include <locale.h>
  219. +#ifdef HAVE_LIBINTL_H
  220.  #include <libintl.h>
  221. +#endif
  222.  #include <stdlib.h>
  223.  #include <limits.h>
  224.  
  225.